package org.millioncall.yueyoga.admin.dao;

import java.util.List;
import java.util.Map;

import org.millioncall.openplatform.common.PaginatedList;
import org.millioncall.yueyoga.admin.model.ProductRemaining;
import org.millioncall.yueyoga.admin.model.ProductUsedInfo;

public interface ProductRemainingDAO {
	/**
	 * 修改会员产品信息
	 * @param productRemaining
	 * @return
	 */
	public int updateProductRemaining(ProductRemaining productRemaining);
	
	public int save(ProductRemaining productRemaining);

	public int update(Map<String, Object> map);
	
	public void deleteByMemberIds(Integer[] deids);

	public PaginatedList<ProductRemaining> findPage(int start, int pageSize,
			Map<String, Object> map);

	public int getCountsByMembetId(Map<String, Object> map);

	public void deleteByIds(Integer[] deids);

	public PaginatedList<ProductRemaining> findMemberProduct(int start,
			int limit, Map<String, Object> map);

	public PaginatedList<ProductRemaining> findProductByMemberId(Integer start,
			Integer limit, Integer memberId);
	
	/**
	 * 查询会员产品的使用情况
	 * @param start
	 * @param limit
	 * @param map
	 * @return
	 */
	public PaginatedList<ProductUsedInfo> findMemberProductsUsed(int start,
			int limit, Map<String, Object> map);
	/**
	 * 根据会员产品使用编号获取使用详情
	 * @param proRemainId
	 * @return
	 */
	public ProductRemaining findProductRemainingById(int proRemainId);
	
	public boolean saveClearOrder(ProductRemaining pr);

	public List<ProductRemaining> findMemberProductById(Map<String, Object> maps);
	
	/**
	 * 查找所有可用剩余产品
	 * @param map 参数集合
	 * @param start 第几页第一条
	 * @param limit 每页显示几条
	 * */
	public PaginatedList<ProductRemaining> findConsumptionProductRemaining(Map<String, Object> map, Integer start, Integer limit);
	
	public boolean deleteByIds(String Ids);
	
	/**
	 * 更新会员剩余次数
	 * @param prId 剩余产品编号
	 * @param counts 要更新的次数
	 * */
	public int updateCounts(Integer prId, Integer counts);
	
	/**
	 * 通过会员和产品编号获得会员的产品剩余信息
	 * @param map（memberId,productId）
	 * @return ProductRemaining
	 */
	public ProductRemaining findProductRemainingByHyCpId(Map<String, Object> map);
}
